<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import token from '../api/refreshToken';
import update from '../api/update';
onLaunch(() => {
  if (uni.getStorageSync('token')) {
  	token.refresh().then((res: any) => {
  		uni.setStorageSync('token', res.data);
  	});
  }
});
onShow(() => {
  //#ifdef APP-PLUS
  
  // 获取本地应用资源版本号
  plus.runtime.getProperty(plus.runtime.appid, inf => {
  	let version_code = +inf.versionCode;
  	wx.setStorageSync('version_code', version_code);
  
  	//获取服务器的版本号
  	update
  		.getVersion({
  			edition_type: plus.runtime.appid,
  			version_type: uni.getSystemInfoSync().platform
  		})
  		.then((res: any) => {
  
  			//判断后台返回版本号是否大于当前应用版本号 && 是否发行
  			if (Number(res.data.data.edition_number) > version_code && res.data.data.edition_issue == 1) {
  				
  				//注意 这里obj尽量不要修改，如果非要修改，rt-uni-update里的onload的obj也得改
  				uni.navigateTo({
  					url: './uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update?obj=' + JSON.stringify(res.data.data)
  				});
  			}
  		});
  });
  //#endif
});
onHide(() => {
  console.log("App Hide");
});
</script>
<style lang="scss">

@import "./uni_modules/vk-uview-ui/index.scss";
.warptab{
	display: flex;
	flex-direction: column;
		/* height: calc(100vh - var(--window-top)); */
	width: 100%;
}
.box {
	box-sizing: border-box;
}
.w100 {
	width: 100%;
}
.hide {
	display: none;
}

.flexco {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	flex-wrap: wrap;
}


.flexst {
	display: flex;
	justify-content: flex-start;
	align-items: center;
	flex-wrap: wrap;
	flex-direction: row;
}

.flexsted {
	display: flex;
	justify-content: flex-start;
	align-items: flex-end;
	flex-wrap: wrap;
	flex-direction: row;
}

.flexed {
	display: flex;
	justify-content: flex-end;
	align-items: flex-end;
	flex-wrap: wrap;
	flex-direction: row;
}

.flexbe {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	flex-direction: row;
}

.flexad {
	display: flex;
	justify-content: space-around;
	align-items: center;
	flex-wrap: wrap;
	flex-direction: row;
}

.flexco {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	flex-wrap: wrap;
}
.flexcobe {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	flex-direction: column;
	flex-wrap: wrap;
}
.flexcost {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	flex-direction: column;
	flex-wrap: wrap;
}

.flexcoend {
	display: flex;
	justify-content: flex-end;
	align-items: flex-end;
	flex-direction: column;
	flex-wrap: wrap;
}

.flexce {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: row;
}

.tec {
	text-align: center;
}
.pore {
	position: relative;
}

.flexstst {
	display: flex;
	justify-content: flex-start;
	align-items: flex-start;
	flex-direction: row;
}

.fs28 {
	font-size: 28rpx;
}

.fs30 {
	font-size: 30rpx;
}
.fs32 {
	font-size: 32rpx;
}
.fs39 {
	font-size: 39rpx;
}

.fs20 {
	font-size: 20rpx;
}
.fs26 {
	font-size: 26rpx;
}
.fs24 {
	font-size: 24rpx;
}

.cor-ff {
	color: #fff;
}

.bg-ff {
	background: #fff;
}

.b {
	font-weight: bold;
}

.c9 {
	color: #999999;
}
.plr32 {
	padding: 0 32rpx;
}
</style>
